package com.ym.util;

import java.io.Serializable;

/**
 * @auther gilgamesh_ym
 * @date 2021/3/15 17:56
 **/
public class R<T> implements Serializable {

    private static final long serialVersionUID = -6945870328938809071L;

    private Integer code;

    private String msg;

    private T data;

    public static <E> R<E> ok(E data){
        R<E> r = new R<>();
        if(data == null){
            r.code = 1;
            r.data = null;
            r.msg = "";
            return r;
        }else{
            r.code = 0;
            r.data = data;
            r.msg = "success";
            return r;
        }

    }
}
